<template>
  <ul class="todo-list">
    <!-- completed: 完成的类名 -->
    <li v-for="(item) in arr" :key="item.id" :class="{completed:item.isDone}" >
      <div class="view">
        <input v-model="item.isDone" class="toggle" type="checkbox" />
        <label> {{ item.name }} </label>
        <button @click="onDel(item)" class="destroy"></button>
      </div>
    </li>
  </ul>
</template>

<script>
export default {
  props:['arr'],
  methods:{
    // 删除
    onDel(it){
      this.$emit('delItem',it.id)
    }
  }
}
</script>